global root "/Volumes/Workgroup/Lab/Lab-heimb/Montenovo/Volunteering Paper/Data"
global results "$root/07_results/RR/main"
global dictionaries "$root/Dictionaries"


cd "$dictionaries"
capture log close
log using prelim_extensive_regressions, replace

cd "$root"



use appended_analytic_010305111719, clear 

//generate single_male=0
//replace single_male=1 if head_married==0 & sex==1 & sequence_num==1

// I am a single female if I am not married, I am a female, and I am the head
//generate single_female=0
//replace single_female=1 if head_married==0 & sex==2 & sequence_num==1

//generate married_male=0
//replace married_male=1 if head_married==1 & sex==1 
//replace married_male=1 if head_married==1 & sex_spouse==1

//generate married_female=0
//replace married_female=1 if head_married==1 & sex==2

replace whether_volunteer_religious_hd=0 if whether_volunteer_religious_hd==5
replace whether_volunteer_religious_wf=0 if whether_volunteer_religious_wf==5

gen religious_person=.

replace religious_person=0 if calcul_yr_hs_reli_hd==0 | calcul_yr_hs_reli_hd==.a
replace religious_person=0 if calcul_yr_hs_reli_wf==0 |  calcul_yr_hs_reli_wf==.a

replace religious_person=0 if your_estim_yr_hs_reli_hd==0 | your_estim_yr_hs_reli_hd==.a
replace religious_person=0 if your_estim_yr_hs_reli_wf==0 |  your_estim_yr_hs_reli_wf==.a

replace religious_person=0 if hs_other_religious==0 |  hs_other_religious==.a
replace religious_person=0 if hs_other_religious==0 |  hs_other_religious==.a

replace religious_person=0 if whether_volunteer_religious_hd==0 |  whether_volunteer_religious_hd==.a
replace religious_person=0 if whether_volunteer_religious_w==0 | hs_other_religious==.a


replace religious_person=1 if calcul_yr_hs_reli_hd>0 & calcul_yr_hs_reli_hd!=. & calcul_yr_hs_reli_hd!=.a & sequence_num==1
replace religious_person=1 if calcul_yr_hs_reli_wf>0 & calcul_yr_hs_reli_wf!=. & calcul_yr_hs_reli_wf!=.a & sequence_num==2

replace religious_person=1 if your_estim_yr_hs_reli_hd>0 & your_estim_yr_hs_reli_hd!=. & your_estim_yr_hs_reli_hd!=.a & sequence_num==1
replace religious_person=1 if your_estim_yr_hs_reli_wf>0 & your_estim_yr_hs_reli_wf!=. & your_estim_yr_hs_reli_wf!=.a & sequence_num==2

replace religious_person=1 if hs_other_religious>0 & hs_other_religious!=. & hs_other_religious!=.a

replace religious_person=1 if whether_volunteer_religious_hd==1 & sequence_num==1
replace religious_person=1 if whether_volunteer_religious_wf==1 & sequence_num==2

tab religious_person

///////////////////////////////////////////////////////////////////////////////////////


replace whether_volunteer_needy_hd=0 if whether_volunteer_needy_hd==5
replace whether_volunteer_needy_wf=0 if whether_volunteer_needy_wf==5

gen needy_person=.

replace needy_person=0 if calcul_yr_hs_needy_hd==0 | calcul_yr_hs_needy_hd==.a
replace needy_person=0 if calcul_yr_hs_needy_wf==0 |  calcul_yr_hs_needy_wf==.a

replace needy_person=0 if your_estim_yr_hs_needy_hd==0 | your_estim_yr_hs_needy_hd==.a
replace needy_person=0 if your_estim_yr_hs_needy_wf==0 |  your_estim_yr_hs_needy_wf==.a

replace needy_person=0 if hs_other_needy==0 |  hs_other_needy==.a
replace needy_person=0 if hs_other_needy==0 |  hs_other_needy==.a

replace needy_person=0 if whether_volunteer_needy_hd==0 |  whether_volunteer_needy_hd==.a
replace needy_person=0 if whether_volunteer_needy_w==0 | hs_other_needy==.a

replace needy_person=1 if calcul_yr_hs_needy_hd>0 & calcul_yr_hs_needy_hd!=. & calcul_yr_hs_needy_hd!=.a & sequence_num==1
replace needy_person=1 if calcul_yr_hs_needy_wf>0 & calcul_yr_hs_needy_wf!=. & calcul_yr_hs_needy_wf!=.a & sequence_num==2

replace needy_person=1 if your_estim_yr_hs_needy_hd>0 & your_estim_yr_hs_needy_hd!=. & your_estim_yr_hs_needy_hd!=.a & sequence_num==1
replace needy_person=1 if your_estim_yr_hs_needy_wf>0 & your_estim_yr_hs_needy_wf!=. & your_estim_yr_hs_needy_wf!=.a & sequence_num==2

replace needy_person=1 if hs_other_needy>0 & hs_other_needy!=. & hs_other_needy!=.a

replace needy_person=1 if whether_volunteer_needy_hd==1 & sequence_num==1
replace needy_person=1 if whether_volunteer_needy_wf==1 & sequence_num==2

tab needy_person year

/////////////////////////////////////////////////////////////////////////////////////////////

replace whether_volunteer_health_hd=0 if whether_volunteer_health_hd==5
replace whether_volunteer_health_wf=0 if whether_volunteer_health_wf==5

gen health_person=.

replace health_person=0 if calcul_yr_hs_health_hd==0 | calcul_yr_hs_health_hd==.a
replace health_person=0 if calcul_yr_hs_health_wf==0 |  calcul_yr_hs_health_wf==.a

replace health_person=0 if your_estim_yr_hs_health_hd==0 | your_estim_yr_hs_health_hd==.a
replace health_person=0 if your_estim_yr_hs_health_wf==0 |  your_estim_yr_hs_health_wf==.a

replace health_person=0 if hs_other_health==0 |  hs_other_health==.a
replace health_person=0 if hs_other_health==0 |  hs_other_health==.a

replace health_person=0 if whether_volunteer_health_hd==0 |  whether_volunteer_health_hd==.a
replace health_person=0 if whether_volunteer_health_w==0 | hs_other_health==.a


replace health_person=1 if calcul_yr_hs_health_hd>0 & calcul_yr_hs_health_hd!=. & calcul_yr_hs_health_hd!=.a & sequence_num==1
replace health_person=1 if calcul_yr_hs_health_wf>0 & calcul_yr_hs_health_wf!=. & calcul_yr_hs_health_wf!=.a & sequence_num==2

replace health_person=1 if your_estim_yr_hs_health_hd>0 & your_estim_yr_hs_health_hd!=. & your_estim_yr_hs_health_hd!=.a & sequence_num==1
replace health_person=1 if your_estim_yr_hs_health_wf>0 & your_estim_yr_hs_health_wf!=. & your_estim_yr_hs_health_wf!=.a & sequence_num==2

replace health_person=1 if hs_other_health>0 & hs_other_health!=. & hs_other_health!=.a 

replace health_person=1 if whether_volunteer_health_hd==1 & sequence_num==1
replace health_person=1 if whether_volunteer_health_wf==1 & sequence_num==2

tab health_person year

////////////////////////////////////////////////////////////////////////////////////////////////


replace whether_volunteer_senior_hd=0 if whether_volunteer_senior_hd==5
replace whether_volunteer_senior_wf=0 if whether_volunteer_senior_wf==5

gen senior_person=.

replace senior_person=0 if calcul_yr_hs_senior_hd==0 | calcul_yr_hs_senior_hd==.a
replace senior_person=0 if calcul_yr_hs_senior_wf==0 |  calcul_yr_hs_senior_wf==.a

replace senior_person=0 if your_estim_yr_hs_senior_hd==0 | your_estim_yr_hs_senior_hd==.a
replace senior_person=0 if your_estim_yr_hs_senior_wf==0 |  your_estim_yr_hs_senior_wf==.a

replace senior_person=0 if hs_other_senior==0 |  hs_other_senior==.a
replace senior_person=0 if hs_other_senior==0 |  hs_other_senior==.a

replace senior_person=0 if whether_volunteer_senior_hd==0 |  whether_volunteer_senior_hd==.a
replace senior_person=0 if whether_volunteer_senior_w==0 | hs_other_senior==.a


replace senior_person=1 if calcul_yr_hs_senior_hd>0 & calcul_yr_hs_senior_hd!=. & calcul_yr_hs_senior_hd!=.a & sequence_num==1
replace senior_person=1 if calcul_yr_hs_senior_wf>0 & calcul_yr_hs_senior_wf!=. & calcul_yr_hs_senior_wf!=.a & sequence_num==2

replace senior_person=1 if your_estim_yr_hs_senior_hd>0 & your_estim_yr_hs_senior_hd!=. & your_estim_yr_hs_senior_hd!=.a & sequence_num==1
replace senior_person=1 if your_estim_yr_hs_senior_wf>0 & your_estim_yr_hs_senior_wf!=. & your_estim_yr_hs_senior_wf!=.a & sequence_num==2

replace senior_person=1 if hs_other_senior>0 & hs_other_senior!=. & hs_other_senior!=.a

replace senior_person=1 if whether_volunteer_senior_hd==1 & sequence_num==1
replace senior_person=1 if whether_volunteer_senior_wf==1 & sequence_num==2

tab senior_person year

/////////////////////////////////////////////////////////////////////////////////////////////////

replace whether_volunteer_youth_hd=0 if whether_volunteer_youth_hd==5
replace whether_volunteer_youth_wf=0 if whether_volunteer_youth_wf==5

gen youth_person=.

replace youth_person=0 if calcul_yr_hs_youth_hd==0 | calcul_yr_hs_youth_hd==.a
replace youth_person=0 if calcul_yr_hs_youth_wf==0 |  calcul_yr_hs_youth_wf==.a

replace youth_person=0 if your_estim_yr_hs_youth_hd==0 | your_estim_yr_hs_youth_hd==.a
replace youth_person=0 if your_estim_yr_hs_youth_wf==0 |  your_estim_yr_hs_youth_wf==.a

replace youth_person=0 if hs_other_youth==0 |  hs_other_youth==.a
replace youth_person=0 if hs_other_youth==0 |  hs_other_youth==.a

replace youth_person=0 if whether_volunteer_youth_hd==0 |  whether_volunteer_youth_hd==.a
replace youth_person=0 if whether_volunteer_youth_w==0 | hs_other_youth==.a


replace youth_person=1 if calcul_yr_hs_youth_hd>0 & calcul_yr_hs_youth_hd!=. & calcul_yr_hs_youth_hd!=.a & sequence_num==1
replace youth_person=1 if calcul_yr_hs_youth_wf>0 & calcul_yr_hs_youth_wf!=. & calcul_yr_hs_youth_wf!=.a & sequence_num==2

replace youth_person=1 if your_estim_yr_hs_youth_hd>0 & your_estim_yr_hs_youth_hd!=. & your_estim_yr_hs_youth_hd!=.a & sequence_num==1
replace youth_person=1 if your_estim_yr_hs_youth_wf>0 & your_estim_yr_hs_youth_wf!=. & your_estim_yr_hs_youth_wf!=.a & sequence_num==2

replace youth_person=1 if hs_other_youth>0 & hs_other_youth!=. & hs_other_youth!=.a

replace youth_person=1 if whether_volunteer_youth_hd==1  & sequence_num==1
replace youth_person=1 if whether_volunteer_youth_wf==1  & sequence_num==2

tab youth_person year

///////////////////////////////////////////////////////////////////////////////////////////////////

replace whether_volunteer_socchange_hd=0 if whether_volunteer_socchange_hd==5
replace whether_volunteer_socchange_wf=0 if whether_volunteer_socchange_wf==5

gen socchange_person=.

replace socchange_person=0 if whether_volunteer_socchange_hd==0 |  whether_volunteer_socchange_hd==.a
replace socchange_person=0 if whether_volunteer_socchange_wf==0 | whether_volunteer_socchange_wf==.a

replace socchange_person=1 if whether_volunteer_socchange_hd==1 
replace socchange_person=1 if whether_volunteer_socchange_wf==1 

replace socchange_person=0 if calcul_yr_hs_change_hd==0 | calcul_yr_hs_change_hd==.a
replace socchange_person=0 if calcul_yr_hs_change_wf==0 |  calcul_yr_hs_change_wf==.a

replace socchange_person=0 if your_estim_yr_hs_change_hd==0 | your_estim_yr_hs_change_hd==.a
replace socchange_person=0 if your_estim_yr_hs_change_wf==0 |  your_estim_yr_hs_change_wf==.a

replace socchange_person=0 if hs_other_socialchange==0 |  hs_other_socialchange==.a
replace socchange_person=0 if hs_other_socialchange==0 |  hs_other_socialchange==.a

replace socchange_person=1 if calcul_yr_hs_change_hd>0 & calcul_yr_hs_change_hd!=. & calcul_yr_hs_change_hd!=.a & sequence_num==1
replace socchange_person=1 if calcul_yr_hs_change_wf>0 & calcul_yr_hs_change_wf!=. & calcul_yr_hs_change_wf!=.a & sequence_num==2

replace socchange_person=1 if your_estim_yr_hs_change_hd>0 & your_estim_yr_hs_change_hd!=. & your_estim_yr_hs_change_hd!=.a & sequence_num==1
replace socchange_person=1 if your_estim_yr_hs_change_wf>0 & your_estim_yr_hs_change_wf!=. & your_estim_yr_hs_change_wf!=.a & sequence_num==2

replace socchange_person=1 if hs_other_socialchange>0 & hs_other_socialchange!=. & hs_other_socialchange!=.a

replace socchange_person=1 if whether_volunteer_socchange_hd==1  & sequence_num==1
replace socchange_person=1 if whether_volunteer_socchange_wf==1  & sequence_num==2


tab socchange_person year


///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////

drop if education_head==.
/*
 foreach i in religious needy health senior youth socchange {

eststo extensive_h_`i': reghdfe Hyear taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, noabsorb vce(cluster state)

eststo extensive_yrfe_h_`i': reghdfe Hyear taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, absorb(year) vce(cluster state)

eststo extensive_stfe_h_`i': reghdfe Hyear taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, absorb(year state) vce(cluster state)

eststo extensive_fe_h_`i': reghdfe Hyear taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, absorb(year state family_id) vce(cluster state)

drop if year==2010

eststo intensive_h_`i': reghdfe hoursHLB taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, noabsorb vce(cluster state)

eststo intensive_yrfe_h_`i': reghdfe hoursHLB taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, absorb(year) vce(cluster state)

eststo intensive_stfe_h_`i': reghdfe hoursHLB taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, absorb(year state) vce(cluster state)

eststo intensive_fe_h_`i': reghdfe hoursHLB taxprice post_tax_income  page sex_head  head_married black_h native_amer_h asian_h other_h hispanic_head HS_h some_college_h college_grad_h college_plus_h children if `i'_hd==1, absorb(year state family_id) vce(cluster state)

cd "$results"

	 esttab extensive_h_`i' extensive_yrfe_h_`i' extensive_stfe_h_`i' extensive_fe_h_`i' using "extensive_head_`i'.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin - Head of Household" "`i'") addnotes("Col 1: No FE" "Col 2: Year FE" "Col 3: State FE" "Col 4: Year and State FE") modelwidth(12) label 
	 
	 esttab intensive_h_`i' intensive_yrfe_h_`i' intensive_stfe_h_`i' intensive_fe_h_`i' using "intensive_head_`i'.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin - Head of Household" "`i'") addnotes("Col 1: No FE" "Col 2: Year FE" "Col 3: State FE" "Col 4: Year and State FE") modelwidth(12) label
	 
	 }

*/

label var socchange_person "Religious - HD"
label var needy_person "For the Needy - HD"
label var health_person "Health - HD"
label var senior_person "For the Senior - HD"
label var socchange_person "Social Change - HD"


/////////////////////////////////////////////////////////////////////////////////////

gen whether_volunteer_religious=whether_volunteer_person*religious_person
gen whether_volunteer_needy=whether_volunteer_person*needy_person
gen whether_volunteer_health=whether_volunteer_person*health_person
gen whether_volunteer_senior=whether_volunteer_person*senior_person
gen whether_volunteer_socchange=whether_volunteer_person*socchange_person

label var  whether_volunteer_religious "Whether Volunteer*Religious (Head)"
label var  whether_volunteer_needy "Whether Volunteer*For the Needy (Head)"
label var  whether_volunteer_health "Whether Volunteer*Health (Head)"
label var  whether_volunteer_senior "Whether Volunteer*For the Senior (Head)"
label var  whether_volunteer_socchange "Whether Volunteer*Social Change (Head)"

cd "$results"

eststo extensive_fe_relig: reghdfe whether_volunteer_religious taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


eststo extensive_fe_relig_sm: reghdfe whether_volunteer_religious  taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


eststo extensive_fe_relig_sf: reghdfe whether_volunteer_religious  taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_relig_mm: reghdfe whether_volunteer_religious  taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


eststo extensive_fe_relig_mf: reghdfe whether_volunteer_religious  taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
// (dropped 2067 singleton observations)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

cd "$results"

	 esttab extensive_fe_relig extensive_fe_relig_sm extensive_fe_relig_sf extensive_fe_relig_mm extensive_fe_relig_mf using "regress_ext_religion.rtf", se star(* 0.10 ** 0.05 *** 0.01) keep(taxprice) replace se(a4) b(a3) title("Extensive Margin - Volunteering at Religious Organizations") addnotes("Outcome Variable: Whether volunteered at a religious organization" "State, Year, and Individual FE included") modelwidth(12) label mtitle("Pooled" "Single Males" "Single Females" "Married Males" "Married Females") cells(b(star fmt(3)) se(par fmt(3)))
	 
	 

	 eststo extensive_fe_needy: reghdfe whether_volunteer_needy  taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion , absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_needy_sm: reghdfe whether_volunteer_needy  taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_needy_sf: reghdfe whether_volunteer_needy  taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
// (dropped 3327 singleton observations)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_needy_mm: reghdfe whether_volunteer_needy  taxprice post_tax_income hourly_wage_aftertax full_time   age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_needy_mf: reghdfe whether_volunteer_needy  taxprice post_tax_income hourly_wage_aftertax full_time   age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

// (dropped 2067 singleton observations)

cd "$results"

	 esttab extensive_fe_needy extensive_fe_needy_sm extensive_fe_needy_sf extensive_fe_needy_mm extensive_fe_needy_mf using "regress_ext_needy.rtf", se star(* 0.10 ** 0.05 *** 0.01) keep(taxprice) replace se(a4) b(a3) title("Extensive Margin - Volunteering at Organizations for the Needy") addnotes("Outcome Variable: Whether volunteered at an organization for the needy" "State, Year, and Individual FE included") modelwidth(12) label mtitle("Pooled" "Single Males" "Single Females" "Married Males" "Married Females") cells(b(star fmt(3)) se(par fmt(3)))

	 
	 
	 
	 
		 eststo extensive_fe_health: reghdfe whether_volunteer_health taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion , absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_health_sm: reghdfe whether_volunteer_health taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_health_sf: reghdfe whether_volunteer_health taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_health_mm: reghdfe whether_volunteer_health taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_health_mf: reghdfe whether_volunteer_health taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

	 esttab extensive_fe_health extensive_fe_health_sm extensive_fe_health_sf extensive_fe_health_mm extensive_fe_health_mf using "regress_ext_health.rtf", se star(* 0.10 ** 0.05 *** 0.01) keep(taxprice) replace se(a4) b(a3) title("Extensive Margin - Volunteering at Health Organizations") addnotes("Outcome Variable: Whether volunteered at a health organization" "State, Year, and Individual FE included") modelwidth(12) label mtitle("Pooled" "Single Males" "Single Females" "Married Males" "Married Females")  cells(b(star fmt(3)) se(par fmt(3)))
	 
	 
	 
	 
	 	 
		 eststo extensive_fe_senior: reghdfe whether_volunteer_senior taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion , absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_senior_sm: reghdfe whether_volunteer_senior taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_senior_sf: reghdfe whether_volunteer_senior taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_senior_mm: reghdfe whether_volunteer_senior taxprice post_tax_income hourly_wage_aftertax full_time  age rural religion    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_senior_mf: reghdfe whether_volunteer_senior taxprice post_tax_income hourly_wage_aftertax full_time  age  rural religion  black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

	 esttab extensive_fe_senior extensive_fe_senior_sm extensive_fe_senior_sf extensive_fe_senior_mm extensive_fe_senior_mf using "regress_ext_senior.rtf", se star(* 0.10 ** 0.05 *** 0.01) keep(taxprice) replace se(a4) b(a3) title("Extensive Margin - Volunteering at Organizations for the Senior") addnotes("Outcome Variable: Whether volunteered at an organization for the senior" "State, Year, and Individual FE included") modelwidth(12) label mtitle("Pooled" "Single Males" "Single Females" "Married Males" "Married Females")  cells(b(star fmt(3)) se(par fmt(3)))
	 
	 
	 
	 
	 
	 
	 	 	 
eststo extensive_fe_socchange: reghdfe whether_volunteer_socchange taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion , absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_socchange_sm: reghdfe whether_volunteer_socchange taxprice post_tax_income hourly_wage_aftertax full_time  age black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_socchange_sf: reghdfe whether_volunteer_socchange  taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & sequence_num==1 & married==0), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_socchange_mm: reghdfe whether_volunteer_socchange  taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==1 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

eststo extensive_fe_socchange_mf: reghdfe whether_volunteer_socchange taxprice post_tax_income hourly_wage_aftertax full_time  age    black native_amer asian other hispanic HS some_college college_grad college_plus children rural religion  if (sex==2 & married==1), absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

	 esttab extensive_fe_socchange extensive_fe_socchange_sm extensive_fe_socchange_sf extensive_fe_socchange_mm extensive_fe_socchange_mf using "regress_ext_socchange.rtf", se star(* 0.10 ** 0.05 *** 0.01) keep(taxprice) replace se(a4) b(a3) title("Extensive Margin - Volunteering at Organizations for Social Change") addnotes("Outcome Variable: Whether volunteered at an organization for Social Change" "State, Year, and Individual FE included") modelwidth(12) label mtitle("Pooled" "Single Males" "Single Females" "Married Males" "Married Females") cells(b(star fmt(3)) se(par fmt(3)))
	
	cd "$dictionaries"
	
	log close
